package borrowBook;

import java.util.ArrayList;
import java.util.List;

public class LibraryCard {
    private String studentName;
    private List<Book> borrowedBooks;

    public LibraryCard(String studentName)
    {
        this.studentName = studentName;
        this.borrowedBooks = new ArrayList<>();
    }

    public String getStudentName()
    {
        return studentName;
    }

    public List<Book> getBorrowedBooks()
    {
        return borrowedBooks;
    }

    public void borrowBook(Book book)
    {
        if(!book.isBorrowed())
        {
            book.setBorrowed(true);
            borrowedBooks.add(book);
            System.out.println(studentName + "借到了" + book.getTitle() + "书");
        }
        else
        {
            System.out.println(studentName + "没有借到" + book.getTitle() + "书");
        }
    }
}
